
// pages/JiFengRecord/JiFengRecord.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    jifen:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
this.getUserintegralrecord()
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.getUserintegralrecord()
  },
  getUserintegralrecord(){
    let opid= wx.getStorageSync('openID')
    if(opid){
      wx.request({
        url: 'http://localhost:5555/users/getUserintegralrecord',
        data:{
          openid:opid
        },
        success:(res)=>{
          this.setData({
            jifen:res.data.data
          })
          const arr = this.data.jifen;
          for(let item of arr){
            let addtime = item.addtime;
            let time = new Date(parseInt(addtime));
            // console.log(time);
            item.addtime = `${time.getFullYear()}年${time.getMonth()+1}月${time.getUTCDate()}日${time.getHours()}时${time.getMinutes()}分`
          }
          this.setData({
            jifen:arr
          })
        }
      })
    }
  }
})